home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 31
/
Aminet 31 (1999)(Schatztruhe)[!][Jun 1999].iso
/
Aminet
/
dev
/
gui
/
gui4cli.lha
/
Gui4Cli
/
Ext
/
GCView
/
gcview.gc
< prev
next >
Wrap
Text File
|
1999-04-21
|
16KB
|
736 lines
G4C
; ******************** This is a Gui4Cli gui *********************
; - You need Gui4Cli version 3.7+ to run it
; - Get it from Aminet or <http://users.hol.gr/~dck/gcmain.htm>
; ****************************************************************
; TAB size is 3
; This gui works fine, but it is still a long way from finished.
; It does however, make gcview easier to use. Feel free to change it..
; ================================================================
WINBIG -1 -10 640 95 '' ; note -10 for top (see guide)
wintype 00001100
screen GCView
; resinfo 8 640 256
BOX 0 0 0 0 out button
xOnLoad
Local scheight/winheight/barheight
screentog = 0 ; screen2front toggle
loadedas = NORMAL
start = 0
frames = 60
file = ''
loadall = ON
andir = PINGPONG
dmode = BG
extract #this guipath mypath
palette = 0
setgad #this 20 hide ; palette lv
JoinFile $mypath Palettes PalPath
lvuse #this 20
lvdir #$PalPath
fcount = 0
savepath = T:
savebase = GCPic
savename = ''
makescreen GCView 3 'Gui4Cli Gui 4 GCView by dck@hol.gr'
; start gcview - should be in the same dir as us
ifexists port ~gcview
joinfile $mypath gcview gcvname
run $gcvname
wait port gcview 100
if $$retcode > 0
ezreq 'Could not launch GCView!\n' Abort ''
guiquit #this
endif
endif
; get our screen height
scheight = 256
barheight = 12
call gcview info pubscreen GCView
tempvar = $$call.ret
parsevar tempvar
if $$parse.total > 3
scheight = $$parse.3
barheight = $$parse.5
endif
; open window right below menu bar & get actual height
; changegad #this 0 -1 $barheight 0 95 '' ; doesn't work.. ?
guiopen #this
info gui #this
winheight = $$win.h
; move screen down..
scpos = $($scheight - $barheight - $winheight)
movescreen #this 0 $scpos ; new function
call gcview set pointer on
; set my palette, if available
ifexists file guis:tools/palette/gray
guiload guis:tools/palette/gray gcview.gc
endif
; notify keys
call gcview notify RMB Gui4Cli 'gosub gcview.gc do_rmb'
; call gcview notify R78 Gui4Cli 'gosub gcview.gc speed_inc'
; call gcview notify R79 Gui4Cli 'gosub gcview.gc speed_dec'
xOnQuit
guiclose #this
killscreen GCView
call gcview quit force
xOnRMB
gosub #this do_rmb
; -----------------------------------------------------------
; RMB routines
; -----------------------------------------------------------
xRoutine do_rmb
if $screentog = 0
guiscreen gcview.gc back
screentog = 1
else
guiscreen gcview.gc front
screentog = 0
endif
; xRoutine speed_inc
; call gcview set speed
; xRoutine speed_dec
; -----------------------------------------------------------
; crop & tile
; -----------------------------------------------------------
XICON 273 0 :icn/crop
gadhelp 'Crops the picture/anim to the size you have marked'
call gcview crop mypic
guiscreen gcview.gc front
; -----------------------------------------------------------
; Tile
; -----------------------------------------------------------
XICON 273 15 :icn/mtile
gosub #this tilepic 1
XICON 273 30 :icn/tile
gosub #this tilepic 0
xRoutine tilepic mirror ; if mirror=1 then do mirror tile
guiwindow #this wait
if $type = ANIM
if $mirror = 1
call gcview tile mypic MIRROR
else
call gcview tile mypic
endif
else
; if there is a box, get size and crop it..
call gcview info boxsize mypic
info = $$call.ret
parsevar info
if $$parse.2 > 0
call gcview crop mypic
endif
call gcview rename mypic brush
call gcview create mypic 640 512 8
call gcview open mypic
call gcview close brush
call gcview set palette mypic brush
if $mirror = 1
call gcview tile brush mypic MIRROR
else
call gcview tile brush mypic
endif
call gcview unload brush
endif
guiwindow #this resume
guiscreen gcview.gc front
; -----------------------------------------------------------
; 4 way mirror tile (for making bgnd patterns)
; -----------------------------------------------------------
XICON 273 45 :icn/mirror ; do 4 way mirror
local w/d/h/sw/sh
if $type = ANIM
flash ; not for anims..
stop
endif
; get sizes
call gcview info size mypic
size = $$call.ret
parsevar size
w = $$parse.0
h = $$parse.1
d = $$parse.2
sw == $w * 2
sh == $h * 2
; prepare background for tiling..
call gcview rename mypic brush
call gcview create mypic $sw $sh $d
call gcview open mypic
call gcview close brush
call gcview set palette mypic brush
; paste & flip & paste...
call gcview paste brush mypic 0 0
call gcview flip brush horizontal
call gcview paste brush mypic $w 0
call gcview flip brush vertical
call gcview paste brush mypic $w $h
call gcview flip brush horizontal
call gcview paste brush mypic 0 $h
; finished..
call gcview unload brush
guiscreen gcview.gc front
; -----------------------------------------------------------
; Flip and rotate buttons
; -----------------------------------------------------------
XICON 303 0 :icn/HFlip
call gcview flip mypic horizontal
XICON 303 15 :icn/VFlip
call gcview flip mypic vertical
XICON 303 30 :icn/RRotate
call gcview rotate mypic right
XICON 303 45 :icn/LRotate
call gcview rotate mypic left
; -----------------------------------------------------------
; PAN
; -----------------------------------------------------------
; ------------- Vertical
XICON 334 45 :icn/vpan
call gcview pan mypic MIRROR VERTICAL
XICON 333 30 :icn/vpanNoMirr
call gcview pan mypic VERTICAL
; ------------ Horizintal
XICON 333 0 :icn/panNoMirr
call gcview pan mypic
XICON 333 15 :icn/pan
call gcview pan mypic MIRROR
; -----------------------------------------------------------
; SAVE, QUIT...
; -----------------------------------------------------------
; ------------ normal save
XICON 605 4 :icn/save
local fname/fileline
if $file < ' '
file = T:GCPic
endif
; store the current line in lv, so we can go back to it
; after refreshing the lv
lvuse #this 1
fileline = $$lv.line
; try to be clever.. Use previously saved file's path
if $savename > ''
extract savename path savename
extract file file fname
joinfile $savename $fname fname
else
fname = $file
endif
savename = ''
call gcview move pubscreen GCView 0 15
ReqFile -1 -1 300 -40 'Save current picture:' SAVE savename #$fname
call gcview move pubscreen GCView 0 $scpos
if $savename > ''
ifexists file $savename
ezreq 'File already exists:\n- $savename\nOverwite ?' OverWrite|Cancel choice
if $choice = 0
stop ; user cancelled
endif
endif
guiwindow #this wait
call gcview save mypic '$savename'
guiwindow #this resume
; refresh the dir, and go to previously current line
lvdir refresh
lvmove #$fileline
lvgo #$fileline
lvmulti on
endif
; ------------ Clear & quit
XICON 605 19 :icn/clear
; unload all pics and anims (keep palettes)
call gcview unload #PIC
call gcview unload #ANIM
XICON 605 34 :icn/quit
local choice
ezreq 'Quit GCView ?' 'Quit|CANCEL' choice
if $choice = 1
guiquit #this
endif
; ------------ Open/Close WB
XICON 605 54 :icn/wbtog
ifexists screen 'Workbench'
workbench close
else
workbench open
endif
; -----------------------------------------------------------
; The listview
; -----------------------------------------------------------
XLISTVIEW 4 0 210 92 "" file "" 10 DIR
gadid 1
gadfont #mono 8 000
attr lvfilter "~(#?.info)" ; set filter - no icons
gosub #this showfile
guiscreen gcview.gc front
lvmulti none
lvmove #$$lv.line
lvmulti on
xRoutine showfile ; show $file - also used from view icon
gosub gcview.gc gettype
if $type != NONE
and $type != ANIM
if $dmode = BG ; normal background
call gcview rename mypic oldpic
call gcview load $file mypic
if $$retcode > 0 ; no memory..
call gcview unload oldpic
call gcview load $file mypic
call gcview open mypic
else
call gcview open mypic
call gcview unload oldpic
endif
if $usepalette = ON
call gcview set palette mypic mypal
endif
bgdir = $$lv.dir
gosub #this showinfo
else ; paste brush mode
gosub GCVIEW.GC pastebrush
endif
elseif $type = ANIM
if $dmode = BG
bgdir = $$lv.dir
gosub #this playanim